<!DOCTYPE html>
<html>
<head>
<include file="Include:meta" />
<title>任务管理-目的地运营集团数据管理平台</title>
<include file="Include:style" />
<style>
	.item-float{ width: 33.33%; }
</style>
</head>
<body>
<include file="Include:header" />
<include file="Include:left" />
<div id="main">
	<div class="crumbs">
		<if condition="$pid neq NULL"><div class="crumbs-text">项目 > [{$project['project_num']}]{$project['project_name']} > 任务详情</div><else /><div class="crumbs-text">任务管理 > 任务详情</div></if>
		
	</div>
	<div id="content">
		<if condition="$pid neq NULL">
		</if>
		<div class="form-main">
			<div class="form-title">[{$project['project_num']}]{$project['project_name']}（{$result['order_number']}）</div>
			<div class="form-sub-title">任务概况</div>
			<div class="form-item clearfix">
				<div class="item-float">
					<div class="input-label">任务分类</div>
					<div class="input-item">
						{$result['type1_name']}
						<if condition="$result['type1'] eq 75">({$result['type1_other']})</if>
					</div>
				</div>
				<div class="item-float">
					<div class="input-label">任务子类</div>
					<div class="input-item">
						{$result['type2_name']}
						<if condition="$result['type2'] eq 563">({$result['type2_other']})</if>
					</div>
				</div>
				<div class="item-float">
					<div class="input-label">任务明细</div>
					<div class="input-item">
						{$result['type3_name']}
						<if condition="$result['type3'] eq 161">({$result['type3_other']})</if>
					</div>
				</div>
			</div>
			<div class="form-item clearfix">
				<div class="item-float">
					<div class="input-label">任务名称</div>
					<div class="input-item">
						{$result['name']}
					</div>
				</div>
				<div class="item-float">
					<div class="input-label">任务负责人</div>
					<div class="input-item">
						{$result['head_user']}
					</div>
				</div>
				<div class="item-float">
					<div class="input-label">督导</div>
					<div class="input-item">
						{$result['add_user']}
					</div>
				</div>
			</div>
			<div class="form-item clearfix">
				<div class="item-float">
					<div class="input-label">开始日期</div>
					<div class="input-item">
						{$result['start_date']}
					</div>
				</div>
				<div class="item-float">
					<div class="input-label">截止日期</div>
					<div class="input-item">
						{$result['end_date']}
					</div>
				</div>
			</div>
			<div class="form-item">
				<div class="input-label">任务说明</div>
				<div class="input-item">
					{$result['remark']}
				</div>
			</div>
			<div class="form-item">
				<div class="input-label">附件</div>
				<div class="input-item">
					<foreach name="result['file_url']" item="vv" key="vkey">
					{$result['file_name'][$vkey]}<a href="{$vv}" target="_blank" data-toggle="tooltip" data-placement="right" title="下载" class="ml5 mr15"><i class="glyphicon glyphicon-download-alt"></i></a>
					</foreach>
				</div>
			</div>
			<div class="form-sub-title">人员安排
				<if condition="(($pid eq NULL and (($result['head_uid'] eq $login_id) or ($result['add_uid'] eq $login_id))) or ($pid neq NULL and (((((get_permission('XM',NULL,3)) and ($project['add_uid'] eq $login_id)) or (get_permission('XM',NULL,2) and (in_array($project['center_id'],$login_manage_id))) or (get_permission('XM',NULL,1))) or ($project['director_uid'] eq $login_id) or ($project['manager_uid'] eq $login_id)) and ($project['status'] eq 1)))) and ($result['status'] eq -1)">
				<a href="javascript:;" data-toggle="tooltip" data-placement="right" title="" class="pep_add ml10" data-original-title="添加"><i class="glyphicon glyphicon-plus"></i></a>
				</if>
			</div>
			<div class="form-table-item">
				<table class="table">
					<tr class="form-table-header Text_c">
						<td>姓名</td>
						<td>任务说明</td>
						<td>截止日期</td>
						<td>成果</td>
						<td>完结评语</td>
						<if condition="(($pid eq NULL and (($result['head_uid'] eq $login_id) or ($result['add_uid'] eq $login_id))) or ($pid neq NULL and (((((get_permission('XM',NULL,3)) and ($project['add_uid'] eq $login_id)) or (get_permission('XM',NULL,2) and (in_array($project['center_id'],$login_manage_id))) or (get_permission('XM',NULL,1))) or ($project['director_uid'] eq $login_id) or ($project['manager_uid'] eq $login_id)) and ($project['status'] eq 1)))) and ($result['status'] eq -1) and $audit eq NULL">
						<td>管理</td>
						</if>
					</tr>
					<if condition="$result_d eq NULL">
					<tr><td class='text-center' <if condition="(($pid eq NULL and (($result['head_uid'] eq $login_id) or ($result['add_uid'] eq $login_id))) or ($pid neq NULL and (((((get_permission('XM',NULL,3)) and ($project['add_uid'] eq $login_id)) or (get_permission('XM',NULL,2) and (in_array($project['center_id'],$login_manage_id))) or (get_permission('XM',NULL,1))) or ($project['director_uid'] eq $login_id) or ($project['manager_uid'] eq $login_id)) and ($project['status'] eq 1)))) and ($result['status'] eq -1)">colspan="6"<else />colspan="5"</if>>暂无相关内容</td></tr>
					</if>
					<foreach name="result_d" item="vo">
						<if condition="!(($pid eq NULL and (($result['head_uid'] eq $login_id) or ($result['add_uid'] eq $login_id))) or ($pid neq NULL and (((((get_permission('XM',NULL,3)) and ($project['add_uid'] eq $login_id)) or (get_permission('XM',NULL,2) and (in_array($project['center_id'],$login_manage_id))) or (get_permission('XM',NULL,1))) or ($project['director_uid'] eq $login_id) or ($project['manager_uid'] eq $login_id)) and ($project['status'] eq 1))))">
							<if condition="$login_id eq $vo['uid'] or $audit neq NULL">
							<tr>
								<td width="90">{$vo['username']}<input type="hidden" mid="{$vo['uid']}"></td>
								<td>{$vo['note']}</td>
								<td width="90">{$vo['end_date']}</td>
								<td width="270">
									<if condition="$login_id eq $vo['uid'] and $vo['status'] eq -1 and $result['status'] eq -1 and $vo['file_url'] eq NULL">
									<div class="input-group w200 left">
										<input type="text" name="file_name" value="{$vo['file_name']}" class="form-control file-name" placeholder="请上传附件" readonly autocomplete="off">
										<span class="input-group-btn">
											<button class="btn file-submit" type="button">上传</button>
										</span>
									</div>
									<button class="btn file-sub ml5 hide" mid="{$vo['id']}" type="button">提交</button>
									<input type="hidden" name="file_url" class="file-url" autocomplete="off">
									<span class="error-item">请上传文件</span>
									<span class="error-item">文件名必填</span>
									<else />
										<if condition="$vo['file_url'] neq NULL">
										{$vo['file_name']}<a href="{$vo['file_url']}" target="_blank" data-toggle="tooltip" data-placement="right" title="下载" class="ml5"><i class="glyphicon glyphicon-download-alt"></i></a>
										<if condition="$vo['status'] eq -1">
										<a href="javascript:void(0)" data-toggle="tooltip" data-placement="right" title="删除" class="ml5 del_b" action="delete_file" mid="{$vo['id']}"><i class="glyphicon glyphicon-trash"></i></a>
										</if>
										</if>
									</if>
								</td>
								<td><if condition="$vo['status'] neq -1">({$vo['score']}分){$vo['score_comments']}</if></td>
								<if condition="(($pid eq NULL and (($result['head_uid'] eq $login_id) or ($result['add_uid'] eq $login_id))) or ($pid neq NULL and (((((get_permission('XM',NULL,3)) and ($project['add_uid'] eq $login_id)) or (get_permission('XM',NULL,2) and (in_array($project['center_id'],$login_manage_id))) or (get_permission('XM',NULL,1))) or ($project['director_uid'] eq $login_id) or ($project['manager_uid'] eq $login_id)) and ($project['status'] eq 1)))) and ($result['status'] eq -1)">
								<td width="80">
									<a href="javascript:;" class="mr5 pep_edit" data-toggle="tooltip" data-placement="left" data-original-title="编辑" mid="{$vo['id']}"><i class="glyphicon glyphicon-edit"></i></a>
									<a href="javascript:;" class="mr5 delete" mid="{$vo['id']}" action="delete_user" data-toggle="tooltip" data-placement="left" data-original-title="删除"><i class="glyphicon glyphicon-trash"></i></a>
									<a href="javascript:;" class="sub_btn" data-toggle="tooltip" data-placement="left" data-original-title="完结" mid="{$vo['id']}"><i class="glyphicon glyphicon-ok"></i></a>
								</td>
								</if>
							</tr>
							</if>
						<else />
							<tr>
								<td width="90">{$vo['username']}<input type="hidden" mid="{$vo['uid']}"></td>
								<td>{$vo['note']}</td>
								<td width="90">{$vo['end_date']}</td>
								<td width="270">
									<if condition="$login_id eq $vo['uid'] and $vo['status'] eq -1 and $audit eq NULL">
									<div class="input-group w200 left">
										<input type="text" name="file_name" value="{$vo['file_name']}" class="form-control file-name" placeholder="请上传附件" readonly autocomplete="off">
										<span class="input-group-btn">
											<button class="btn file-submit" type="button">上传</button>
										</span>
									</div>
									<button class="btn file-sub ml5 hide" mid="{$vo['id']}" type="button">提交</button>
									<input type="hidden" name="file_url" class="file-url" autocomplete="off">
									<span class="error-item">请上传文件</span>
									<span class="error-item">文件名必填</span>
									<else />
										<if condition="$vo['file_url'] neq NULL">
										{$vo['file_name']}<a href="{$vo['file_url']}" target="_blank" data-toggle="tooltip" data-placement="right" title="下载" class="ml5"><i class="glyphicon glyphicon-download-alt"></i></a>
										</if>
									</if>
								</td>
								<td><if condition="$vo['status'] neq -1">({$vo['score']}分){$vo['score_comments']}</if></td>
								<if condition="(($pid eq NULL and (($result['head_uid'] eq $login_id) or ($result['add_uid'] eq $login_id))) or ($pid neq NULL and (((((get_permission('XM',NULL,3)) and ($project['add_uid'] eq $login_id)) or (get_permission('XM',NULL,2) and (in_array($project['center_id'],$login_manage_id))) or (get_permission('XM',NULL,1))) or ($project['director_uid'] eq $login_id) or ($project['manager_uid'] eq $login_id)) and ($project['status'] eq 1)))) and ($result['status'] eq -1) and $audit eq NULL">
								<td width="80">
									<if condition="$vo['status'] eq -1">
									<a href="javascript:;" class="mr5 pep_edit" data-toggle="tooltip" data-placement="left" data-original-title="编辑" mid="{$vo['id']}"><i class="glyphicon glyphicon-edit"></i></a>
									<a href="javascript:;" class="mr5 delete" mid="{$vo['id']}" action="delete_user" data-toggle="tooltip" data-placement="left" data-original-title="删除"><i class="glyphicon glyphicon-trash"></i></a>
									<a href="javascript:;" class="sub_btn" data-toggle="tooltip" data-placement="left" data-original-title="完结" mid="{$vo['id']}"><i class="glyphicon glyphicon-ok"></i></a>
									</if>
								</td>
								</if>
							</tr>
						</if>
					</foreach>
				</table>
			</div>
			<if condition="(($pid eq NULL and (($result['head_uid'] eq $login_id) or ($result['add_uid'] eq $login_id))) or ($pid neq NULL and (((((get_permission('XM',NULL,3)) and ($project['add_uid'] eq $login_id)) or (get_permission('XM',NULL,2) and (in_array($project['center_id'],$login_manage_id))) or (get_permission('XM',NULL,1))) or ($project['director_uid'] eq $login_id) or ($project['manager_uid'] eq $login_id)) and ($project['status'] eq 1)))) and ($result['status'] neq -1) or $audit neq NULL">
				<div class="form-sub-title">任务成果</div>
				<div class="form-item">
					<div class="input-label">总结</div>
					<div class="input-item">
						{$result['conclusion']}
					</div>
				</div>
				<div class="form-item">
					<div class="input-label">成果</div>
					<div class="input-item">
						<foreach name="result['file_url_c']" item="vv" key="vkey">
						{$result['file_name_c'][$vkey]}<a href="{$vv}" target="_blank" data-toggle="tooltip" data-placement="right" title="下载" class="ml5 mr15"><i class="glyphicon glyphicon-download-alt mr5"></i></a>
						</foreach>
					</div>
				</div>
				<if condition="$result['status'] neq -1">
					<div class="form-sub-title">审核流程</div>
					<if condition="$result['status'] neq -1">
					<foreach name="audit_user" item="vo">
						<div class="form-item clearfix">
							<div class="input-label">{$vo['audit_name']}</div>
							<div class="input-item">
								<if condition="$vo['audit_date'] neq NULL">
									{$vo['audit_user']}({$vo['audit_date']|substr=0,10})<if condition="$vo['audit_comments'] neq NULL">:{$vo['audit_comments']}</if><if condition="$vo['dh_message'] neq NULL"><br/><span>打回至"{$vo['arrive_name']}"({$vo['dh_date']|substr=0,10})原因:{$vo['dh_message']}</span></if><if condition="$vo['arrive_info'] neq NULL"><br/><span>"{$vo['arrive_name']}"({$vo['arrive_date']|substr=0,10})回复:{$vo['arrive_info']}</span></if>
								<else/>
									<span class='red'>[未审核]{$vo['audit_user']}</span><if condition="$vo['dh_message'] neq NULL"><br/><span class='red'>打回至"{$vo['arrive_name']}"({$vo['dh_date']|substr=0,10})原因:{$vo['dh_message']}</span></if><if condition="$vo['arrive_info'] neq NULL"><br/><span class='red'>"{$vo['arrive_name']}"({$vo['arrive_date']|substr=0,10})回复:{$vo['arrive_info']}</span></if>
								</if>
							</div>
						</div>
					</foreach>
					</if>
					<!--<if condition="$result['dh_uid'] neq NULL">
						<div class="form-item clearfix">
							<div class="item-float">
								<div class="input-label"><span class="red">打回原因</span></div>
								<div class="input-item">
									<span class="red">{$result['dh_user']}({$result['dh_date']|substr=0,10}):{$result['dh_message']}</span>
								</div>
							</div>
						</div>
					</if>
					<if condition="$result['submit_info'] neq NULL">
						<div class="form-item clearfix">
							<div class="item-float">
								<div class="input-label"><span class="red">重新提交</span></div>
								<div class="input-item">
									<span class="red">{$result['submit_user']}:{$result['submit_info']}</span>
								</div>
							</div>
						</div>
					</if>-->
				</if>
			</if>
		</div>
		<div class="form-btn-item">
		<if condition="(($pid neq NULL and (((((get_permission('XM',NULL,3)) and ($project['add_uid'] eq $login_id)) or (get_permission('XM',NULL,2) and (in_array($project['center_id'],$login_manage_id))) or (get_permission('XM',NULL,1))) or ($project['director_uid'] eq $login_id) or ($project['manager_uid'] eq $login_id)) and ($project['status'] eq 1)))) and $audit eq NULL">
			<if condition="$result['status'] eq -1">
				<if condition="$ct eq 0 and $result_d neq NULL">
					<if condition="$result['dh_message'] neq ''">
						<button type="submit" mid="{$result['id']}" uuid="{$login_id}" class="btn btn-rest-submit">重新提交</button>
					<else/>
						<button type="submit" mid="{$result['tid']}" class="btn btn-submit">提交</button>
					</if>
				</if>
			<elseif condition="$result['status'] eq 1"/>
				<button type="submit"  mid="{$result['id']}" uuid="{$login_id}" class="btn btn-remove">放弃提交</button>
			</if>
		</if>
		<if condition="$audit neq ''">
			<if condition="$result['status'] egt 0">
				<if condition="($shenhe eq 1)">
					<button status="{$result['status']}" mid="{$result['id']}" uuid="{$login_id}" class="btn btn-audit2 mr5" type="button">审核</button>
					<button status="-1" mid="{$result['id']}" uuid="{$login_id}" class="btn btn-back mr5" type="button">打回</button>
				</if>
				<if condition="($qishen eq 1) and ($result['status'] neq 3)">
					<button status="{$result['status']}" mid="{$result['id']}" class="btn btn-giveup mr5" type="button">弃审</button>
				</if>
			</if>
		<else />
		<button class="btn btn-default goback1" type="button">返回</button>
		</if>
		</div>
	</div>
</div>
<!--人员安排弹出框-->
<div class="modal fade" id="pepmodal">
	<div class="modal-dialog w700">
		<div class="modal-content">
			<div class="modal-header">
				<h4>人员安排</h4>
				<i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
			</div>
			<form id="task_user_ap" action="#" method="post">
			<div class="modal-body">
				<div class="form-main" style="border:none;padding:0;margin:0">
					<div class="form-item clearfix" style="margin:0">
						<div class="item-float" style="width:50%">
							<div class="input-label"><span class="asterisk">*</span>姓名</div>
							<div class="input-item">
								<select name="uid" class="form-control required-selted w150" autocomplete="off">
									<option value="-10">请选择</option>
									<foreach name="user_list" item="vo">
										<option value="{$vo['id']}">{$vo['username']}</option>
									</foreach>
								</select>
								<span class="error-item">必填项</span>
							</div>
						</div>
						<div class="item-float" style="width:50%">
							<div class="input-label"><span class="asterisk">*</span>截止日期</div>
							<div class="input-item">
								<input type="text" name="end_date" class="form-control Wdate w100 required-text" onclick="WdatePicker({skin:'whyGreen',minDate:'<?php echo $result['start_date'];?>',maxDate:'<?php echo $result['end_date'];?>'})" readonly="" autocomplete="off">
								<span class="error-item">必填项</span>
							</div>
						</div>
					</div>
					<div class="form-item" style="margin:0">
						<div class="input-label"><span class="asterisk">*</span>任务说明</div>
						<div class="input-item">
							<textarea name="note" class="form-control h150 required-text" style="width:440px" autocomplete="off"></textarea>	
							<span class="error-item">必填项</span>
						</div>
					</div>
				</div>
			</div>
			<div class="modal-footer">
				<input type="hidden" name="pid" value="{$project['id']}" />
				<button type="button" class="btn btn-affirm3">确认</button>
				<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
			</div>
			</form>
		</div>
	</div>
</div>
<!--人员完结弹出框-->
<div class="modal fade" id="usermodal">
	<div class="modal-dialog w700">
		<div class="modal-content">
			<div class="modal-header">
				<h4>完结</h4>
				<i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
			</div>
			<form id="task_user_wj" action="#" method="post">
			<div class="modal-body">
				<div class="form-main" style="border:none;padding:0;margin:0">
					<div class="form-item" style="margin:0">
						<div class="input-label"><span class="asterisk">*</span>评分</div>
						<div class="input-item">
							<select name="score" class="form-control required-selted" autocomplete="off">
								<option value="-10">请选择</option><option value="10">10分</option><option value="9">9分</option><option value="8">8分</option><option value="7">7分</option><option value="6">6分</option><option value="5">5分</option><option value="4">4分</option><option value="3">3分</option><option value="2">2分</option><option value="1">1分</option>
							</select>
							<span class="error-item">必填项</span>
						</div>
					</div>
					<div class="form-item" style="margin:0">
						<div class="input-label"><span class="asterisk">*</span>评语</div>
						<div class="input-item">
							<textarea name="score_comments" class="form-control w400 h150 required-text" autocomplete="off"></textarea>	
							<span class="error-item">必填项</span>
						</div>
					</div>
				</div>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-affirm1">确认</button>
				<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
			</div>
			</form>
		</div>
	</div>
</div>
<!--项目完结弹出框-->
<div class="modal fade" id="customeModal">
	<div class="modal-dialog w700">
		<div class="modal-content">
			<form id="task_form" action="#" method="post">
			<div class="modal-header">
				<h4>提交</h4>
				<i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
			</div>
			<div class="modal-body">
				<div class="form-main" style="border:none;padding:0;margin:0">
					<div class="form-item clearfix" style="margin:0">
						<div class="input-label"><span class="asterisk">*</span>总结</div>
						<div class="input-item">
							<textarea name="conclusion" class="form-control w400 h150 required-text" autocomplete="off"></textarea>
							<span class="error-item">必填项</span>
						</div>
					</div>
					<div class="editor_cont">
						<div class="form-item clearfix" style="margin:0">
							<div class="input-label"><span class="asterisk">*</span>成果</div>
							<div class="input-item">
								<div class="input-group w200 left mr10">
									<input type="text" name="file_name[]" class="form-control file-name" placeholder="请上传相关文档" readonly autocomplete="off">
									<span class="input-group-btn">
										<button class="btn file-submit" type="button">上传</button>
									</span>
								</div>
								<input type="hidden" name="file_url[]" class="file-url" autocomplete="off">
								<span class="error-item">文件名必填</span>
								<a href="javascript:;" class="data-add" data-toggle="tooltip" data-placement="bottom" title="生成"><i class="glyphicon glyphicon-plus"></i></a>
								<span class="error-item">请添加一个文件</span>
								<span class="error-item">请先上传此附件</span>
								<span class="error-item">文件名不能有“,”符号</span>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-affirm2">确认</button>
				<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
			</div>
			</form>
		</div>
	</div>
</div>
<!--重新提交框-->
<div class="modal fade" id="myModal_submit">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<h4>重新提交</h4>
				<i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
			</div>
			<div class="modal-body">
				<table class="table table-bordered">
					<tr>
						<td class="text-right" width="74"><strong><span class="asterisk">*</span>原因</strong></td>
						<td>
							<textarea name="remark" placeholder="重新提交理由" class="form-control w300 submit_info left" style="width:100%; height:150px" autocomplete="off"></textarea>
							<span class="error-item left">必填项</span>
						</td>
					</tr>
				</table>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-affirm4">确认</button>
				<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
			</div>
		</div>
	</div>
</div>
<!--弹框-->
<div class="modal fade" id="edit-modal">
	<div class="modal-dialog w600">
		<div class="modal-content">
			<div class="modal-header">
				<h4></h4>
				<i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
			</div>
			<div class="modal-body" style="line-height:30px;">
				<table class="table table-bordered">
					<tr>
						<td class="text-right" width="74"><strong><span class="asterisk">*</span>审核</strong></td>
						<td>
							<textarea name="text_hid" class="form-control required-text" style="width:100%; height:150px" autocomplete="off"></textarea>
							<input type="hidden" name="audit_message">
							<span class="error-item">必填项</span>
						</td>
					</tr>
				</table>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-affirm5">确认</button><button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
			</div>
		</div>
	</div>
</div>
<!--打回弹框-->
<div class="modal fade" id="back-modal">
	<div class="modal-dialog w600">
		<div class="modal-content">
			<div class="modal-header">
				<h4></h4>
				<i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
			</div>
			<div class="modal-body" style="line-height:30px;">
				<table class="table table-bordered">
					<tr>
						<td class="text-right" width="95"><strong><span class="asterisk">*</span>打回阶段</strong></td>
						<td>
							<select name="arrive_status" class="form-control required-selted" autocomplete="off">
								<option value="-10" selected>请选择</option>
								<foreach name="audit_list" item="vo">
									<option value="{$vo['audit_sort']}">{$vo['audit_name']}</option>
								</foreach>
							</select>
							<span class="error-item">必填项</span>
						</td>
					</tr>
					<tr>
						<td class="text-right" width="95"><strong><span class="asterisk">*</span>是否重走流程</strong></td>
						<td class="radios">
							<label class="radio-inline"><input type="radio" name="flow_status" value="1" autocomplete="off">是</label>
							<label class="radio-inline"><input type="radio" name="flow_status" value="-1" autocomplete="off">否</label>
							<span class="error-item">必填项</span>
						</td>
					</tr>
					<tr>
						<td class="text-right" width="95"><strong><span class="asterisk">*</span>打回原因</strong></td>
						<td>
							<textarea name="dh_message" class="form-control required-text1" style="width:100%; height:150px" autocomplete="off"></textarea>
							<span class="error-item">必填项</span>
						</td>
					</tr>
				</table>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-affirm6">确认</button><button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
			</div>
		</div>
	</div>
</div>
<include file="Include:javascript" />
<script type="text/javascript">
$(function(){
	$(".goback1").click(function(){
		window.location.href = "__APP__/Index/task_list/pid/{$pid}";
	});
	KindEditor.ready(function(K){
		//上传附件
		var editorFile = K.editor();
		$('.file-submit').on('click',function(){
			var parents = $(this).parents(".input-group");
			editorFile.loadPlugin('insertfile',function(){
				document.cookie="file_name=task";
				document.cookie="file_type=ppt,pptx,pdf,doc,docx,jpg,jpeg,png,xls,xlsx,txt";
				editorFile.plugin.fileDialog({
					clickFn:function(url,title){
						parents.nextAll(".error-item").hide();
						parents.find(".file-name").val(title).prop("readonly",false);
						parents.nextAll(".file-url").val(url);
						parents.nextAll(".file-sub").show();
						editorFile.hideDialog();
					}
				});
			});
		});
	});
	//添加资料
	$("body").on("click",".data-add",function(){
		$(this).siblings('.error-item').hide();
		var val = $(this).siblings('.input-group').find('.form-control').val();
		if((val=="" || /^\s+$/.test(val)) && !$(this).prop("readonly")){
			$(this).parent().find('.error-item').eq(2).show();
		}else{
			var tr = $(this).parents(".form-item"),
				cont = $('.editor_cont'),
				html = tr.clone(true);
			
			html.find(".tooltip,.input-group-btn").remove();
			html.find('.input-label').html('');
			tr.find(".error-item,.file-delete").hide();
			html.find(".file-delete").hide();
			tr.find(":text,:hidden").val("");
			tr.find(".file-name").prop("readonly",true);
			html.find(".data-add").replaceWith("<a href='javascript:;' class='data-delete mr10' data-toggle='tooltip' data-placement='bottom' title='删除'><i class='glyphicon glyphicon-trash'></i></a>");
			html.find(".data-delete,.data-add").tooltip({trigger:'hover'});
			cont.append(html);
		}
	});
	//删除资料
	$(document).on("click",".data-delete",function(){
		$(this).parents(".form-item").remove();
	});
	$('.del_b').ajaxModal({"title_text":"确认提示框","body_text":"您确定要删除吗？","url":"/dms_erp/index.php?s=/Index/task_ajax","data":{"id":"mid","action":"action"}});
	//删除列表
	$(".delete").ajaxModal({"title_text":"确认提示框","body_text":"您确定要删除吗？","url":"/dms_erp/index.php?s=/Index/task_ajax","data":{"id":"mid","action":"action"}});
	
	//附件提交
	$('.file-sub').click(function(){
		var file_url = $(this).next("[name='file_url']").val(),
			file_name = $(this).prev('.input-group').find("[name='file_name']").val(),
			mid = $(this).attr("mid");
		$.ajax({
			type:"POST",
			asnyc:false,
			dataType:"json",
			data:{"mid":mid,"file_url":file_url,"file_name":file_name,"action":"submit_file"},
			url:"__APP__/Index/task_ajax",
			success:function(data){
				success_pop(data['status'],data['msg']);
			}
		})
	})
	//提交
	$('.btn-submit').click(function(){
		var mid = $(this).attr("mid");
		$("#customeModal").modal();
		$('.btn-affirm2').attr('mid',mid)
	})
	$('.sub_btn').click(function(){
		var mid = $(this).attr("mid");
		$('#usermodal').modal();
		$('#usermodal').find('.btn-affirm1').attr("mid",mid);
	})
	$('.pep_edit').click(function(){
		var mid = $(this).attr("mid");
		$('#pepmodal').modal();
		$('#pepmodal').find('.btn-affirm3').attr("mid",mid);
		var name= $(this).parents('tr').find('td').eq(0).find('input').attr('mid');
			explain = $(this).parents('tr').find('td').eq(1).text(),
			date = $(this).parents('tr').find('td').eq(2).text();
		$("[name='uid']").val(name).select2();
		$("[name='note']").val(explain);
		$("[name='end_date']").val(date);
		$('.btn-affirm3').attr('ss',"2");
	})
	$('.pep_add').click(function(){
		$('#pepmodal').modal();
		$('#pepmodal').find('select').val("-10").select2();
		$('#pepmodal').find('.required-text').val('');
		$('.btn-affirm3').attr('ss',"1");
	})
	//验证
	$('.btn-affirm1').click(function(){
		var tag = true;
		$("[name='score']").each(function(){
			var val = $(this).val();
			if(val==-10){
				$(this).nextAll(".error-item").show();
				tag = false;
			}
		});
		$("[name='score_comments']").each(function(){
			var val = $(this).val();
			if(val==''){
				$(this).nextAll(".error-item").show();
				tag = false;
			}
		});
		if(tag){
			var mid = $(this).attr('mid');
			$.ajax({
				type:"POST",
				asnyc:false,
				dataType:"json",
				data:$("#task_user_wj").serialize()+"&action=end_user&mid="+mid,
				url:"__APP__/Index/task_ajax",
				success:function(data){
					$('#usermodal').hide();
					success_pop(data['status'],data['msg']);
				}
			})
		}
	})
	$('.btn-affirm2').click(function(){
		var tag = true;
		$("#customeModal .required-text").each(function(){
			var val = $(this).val();
			if(val=="" || /^\s+$/.test(val)){
				$(this).nextAll(".error-item").show();
				tag = false;
			}
		});
		if($('.editor_cont .form-item').size()<2){
			$('.editor_cont .form-item').eq(0).find('.error-item').eq(2).show();
			tag = false;
		}
		if(tag){
			var mid = $(this).attr('mid');
			$.ajax({
				type:"POST",
				asnyc:false,
				dataType:"json",
				data:$("#task_form").serialize()+"&action=submit_task&mid="+mid,
				url:"__APP__/Index/task_ajax",
				success:function(data){
					$('#customeModal').hide();
					success_pop(data['status'],data['msg']);
				}
			})
		}
	})
	$('.btn-affirm3').click(function(){
		var tag = true;
		$("#pepmodal .required-text").each(function(){
			var val = $(this).val();
			if(val=="" || /^\s+$/.test(val)){
				$(this).nextAll(".error-item").show();
				tag = false;
			}
		});
		$("[name='uid']").each(function(){
			var val = $(this).val();
			if(val==-10){
				$(this).nextAll(".error-item").show();
				tag = false;
			}
		});
		if(tag){
			var ss = $(this).attr('ss'),
				id = $(this).attr('mid'),
				mid = "{$result['tid']}";
			if(ss==1){
				var action = "add_user";
			}else{
				var action = "edit_user";
			}
			$.ajax({
				type:"POST",
				asnyc:false,
				dataType:"json",
				data:$("#task_user_ap").serialize()+"&action="+action+"&mid="+mid+"&id="+id,
				url:"__APP__/Index/task_ajax",
				success:function(data){
					$('#pepmodal').hide();
					success_pop(data['status'],data['msg']);
				}
			})
		}
	})
	$('.required-text').focus(function(){
		$(this).nextAll(".error-item").hide();
	})
	$(".required-selted").change(function(){
		$(this).nextAll('.error-item').hide();
	})
	
	/*重新提交*/
	$(".btn-rest-submit").click(function(){
		var mid = $(this).attr("mid"),
			uuid = $(this).attr("uuid");
		$("#myModal_submit .btn-affirm4").attr("mid",mid);
		$("#myModal_submit .btn-affirm4").attr("uuid",uuid);
		$(".submit_info").removeClass("red").val("");
		$('#myModal_submit').modal('toggle');
	});
	
	$("#myModal_submit .btn-affirm4").click(function(){
		var status = 1,
			uuid = $(this).attr("uuid"),
			state = 1,
			mid = $(this).attr("mid"),
			submit_info = $(".submit_info").val();

		if(submit_info==""||submit_info=="重新提交理由必填"){
			$(".submit_info").addClass("red").val("重新提交理由必填");
		}else{
			$('#myModal_submit').hide();
			$.ajax({
				cache:true,
				type:"POST",
				dataType:"json",
				url:"__APP__/Index/audit_list_ajax",
				data:{"mid":mid,"status":status,"uuid":uuid,"state":state,"submit_info":submit_info},
				success:function(data){
					success_pop(data['status'],data['msg']);
				}
			});
		}
	});

	$(".submit_info").focus(function(){
		if($(this).val()=="重新提交理由必填"){
			$(this).removeClass("red").val("");
		}
	});
	//隐藏错误提示
	$("[name='quarter'],[name='plan']").change(function(){
		$(this).parent().find('.error-item').hide();
	})
	$('.file-name').focus(function(){
		$(this).parents('.input-item').find('.error-item').hide();
	})

	$("[name='text_hid']").each(function(){
		var textss = $(this).text(),
			reg2 = new RegExp("<br/>", "g"),
			str = textss.replace(reg2, "\n");
		$(this).html(str);
	})
	//文本域暂存
	$("[name='text_hid']").blur(function(){
		var val = $(this).val();
			reg = new RegExp("\n", "g"),
    		str = val.replace(reg, "<br/>");
		$("[name='audit_message']").val(str);
	})
	//审核弹框
	$(".btn-audit2").on("click",function(){
		var modal = $("#edit-modal"),
			mid = $(this).attr("mid"),
			uuid = $(this).attr("uuid"),
			status = parseInt($(this).attr('status'))+1;
		modal.find(".modal-header h4").text("审核");
		modal.find(".file-name").prop("readonly",true);
		modal.find(".file-delete").hide();
		modal.find(".btn-affirm5").attr({"mid":mid});
		modal.find(".btn-affirm5").attr({"uuid":uuid});
		modal.find(".btn-affirm5").attr({"status":status});
		modal.modal();
		modal.find("textarea").val('');
	});
	//取消
	$("#edit-modal").on('hidden.bs.modal',function(){
		$(this).find(".error-item").hide();
	});
	//审核
	$("#edit-modal").find(".btn-affirm5").on("click",function(){
		var tag = false;
		$("[name='text_hid']").each(function(){
			var val = $(this).val();
			if(val=="" || /^\s+$/.test(val)){
				$(this).nextAll(".error-item").show();
				tag = true;
			}
		});
		
		if(tag){
			return false;
		}else{
			var mid = $(this).attr("mid"),
				uuid = $(this).attr("uuid"),
				status = $(this).attr("status"),
				audit_message = $("[name='audit_message']").val(),
				modal = $("#edit-modal");
			modal.hide();
			$.ajax({
				type:"POST",
				async:false,
				dataType:"json",
				data:{"mid":mid,"audit_message":audit_message,"uuid":uuid,"status":status,"type":"5"},
				url:"__APP__/Index/audit_list_ajax",
				success:function(data){
					success_pop(data.status,data.msg);
				}
			});
		}
	});
	$(document).on("focus",".required-text",function(){
		$(this).nextAll(".error-item").hide();
	});
	//打回
	$(".btn-back").on("click",function(){
		var modal = $("#back-modal"),
			mid = $(this).attr("mid"),
			uuid = $(this).attr("uuid"),
			status = $(this).attr("status");
		modal.find(".modal-header h4").text("打回");
		modal.find(".file-name").prop("readonly",true);
		modal.find(".file-delete").hide();
		modal.find(".btn-affirm6").attr({"mid":mid});
		modal.find(".btn-affirm6").attr({"uuid":uuid});
		modal.find(".btn-affirm6").attr({"status":status});
		modal.modal();
		modal.find("textarea").val('');
		modal.find("[name='arrive_status']").val('-10').select2();
		modal.find("[name='flow_status']").attr('checked',false);
	});
	//取消
	$("#back-modal").on('hidden.bs.modal',function(){
		$(this).find(".error-item").hide();
	});
	$("#back-modal").find(".btn-affirm6").on("click",function(){
		var tag = false;
		$(".required-text1").each(function(){
			var val = $(this).val();
			if(val=="" || /^\s+$/.test(val)){
				$(this).next(".error-item").show();
				tag = true;
			}
		});
		$("[name='arrive_status']").each(function(){
			var val = $(this).val();
			if(val==-10){
				$(this).nextAll(".error-item").show();
				tag = true;
			}
		})
		if($("#back-modal").find("input:radio:checked").length==0){
			$("#back-modal .radios").find(".error-item").show();
			tag = true;
		}
		if(tag){
			return false;
		}else{
			var modal = $("#back-modal"),
				mid = $(this).attr("mid"),
				uuid = $(this).attr("uuid"),
				status = $(this).attr("status"),
				dh_status = "{$result['status']}",
				dh_message = $("[name='dh_message']").val(),
				arrive_status = $("[name='arrive_status']").val(),
				flow_status = modal.find('input:radio:checked').val();
				
			modal.hide();
			$.ajax({
				type:"POST",
				async:false,
				dataType:"json",
				data:{"mid":mid,"dh_message":dh_message,"uuid":uuid,"status":status,"flow_status":flow_status,"arrive_status":arrive_status,"dh_status":dh_status},
				url:"__APP__/Index/audit_list_ajax",
				success:function(data){
					success_pop(data['status'],data['msg']);
				}
			});
		}
	});
	$(document).on("focus",".required-text1",function(){
		$(this).nextAll(".error-item").hide();
	});
	$("[name='arrive_status']").change(function(){
		$(this).nextAll(".error-item").hide();
	})
	$("#back-modal .radios label").click(function(){
		$("#back-modal .radios .error-item").hide();
	})
	//弃审
	$('.btn-giveup').on("click",function(){
		var status = $(this).attr('status'),
			mid = $(this).attr("mid");
		$.ajax({
			cache:true,
			type:"POST",
			dataType:"json",
			url:"__APP__/Index/audit_list_ajax",
			data:{"mid":mid,"status":status},
			success:function(data){
				success_pop(data['status'],data['msg']);
			}
		});
	});
	$('.btn-remove').on("click",function(){
		var status = -1,
			state = 1,
			mid = $(this).attr("mid");
		$.ajax({
			cache:true,
			type:"POST",
			dataType:"json",
			url:"__APP__/Index/audit_list_ajax",
			data:{"mid":mid,"status":status,"state":state},
			success:function(data){
				success_pop(data['status'],data['msg']);
			}
		});
	});
	//提示隐藏
	$(".required-selted,.apply-selected,[name='rank_one'],[name='rank_two']").change(function(){
		$(this).nextAll('.error-item').hide();
	})
	$("[name='quarters_remark'],[name='reason']").focus(function(){
		$(this).next('.error-item').hide();
	})
	$("[name='nature']").click(function(){
		$('.error-item1').hide();
	})
});
</script>
</body>
</html>